{include file="../template/header.html" /}
<div class="my-3 my-md-5">
    <div class="container">
        <div class="row row-cards">
            <div class="col-lg-4">
                <form class="card" method="POST">
                    <div class="card-body">
                        <h4>筛选</h4>
                        {eq name="Think.session.type" value="admin"}
                        {eq name="Think.session.cid" value="0"}
                        <div class="form-group">
                            <label class="form-label">分店</label>
                            <select class="form-control" name="branch"></select>
                        </div>
                        {/eq}
                        <div class="form-group">
                            <label class="form-label">医生</label>
                            <select class="form-control" name="doctor"></select>
                        </div>
                        {/eq}
                        <div class="form-group">
                            <div class="form-label">姓名</div>
                            <input type="text" name="name" class="form-control" />
                        </div>
                        <div class="form-group">
                            <div class="form-label">就诊日期</div>
                            <input type="date" name="date" class="form-control" />
                        </div> 
                        <div class="form-group">
                            <div class="form-label">手机号</div>
                            <input type="text" name="phone" class="form-control" />
                        </div>
                    </div>
                    <div class="card-footer text-right">
                        <button type="submit" name="fitter" class="btn btn-primary">Search</button>
                    </div>
                </form>
            </div>
            <div class="col-lg-8">
                <div class="card">
                    <table class="table card-table table-vcenter">
                        <tr>
                            <th></th>
                            <th>姓名</th>
                            <th>手机</th>
                            <th>就诊日期</th>
                            <th>操作</th>
                        </tr>
                        {volist name="arr" id="data" key="i"}
                            <tr>
                                <td><span class="avatar d-block rounded" style="background-image: url('{$data.photo}')"></span></td>
                                <td><a href="/Customer/Detail/id/{$data.id}">{$data.name}</a></td>
                                <td>{$data.tel}</td>
                                <td>{$data.firstdate}</td>
                                <th><a href="/Customer/Detail/id/{$data.id}" class="btn btn-success btn-sm">查看</a><a href="/Customer/Edit/id/{$data.id}" class="btn btn-primary btn-sm">修改</a><a href="/Customer/Del/id/{$data.id}" class="btn btn-danger btn-sm">删除</a></th>
                            </tr>
                        {/volist}
                        
                        
                    </table>
                </div>
                <div class="col-lg8 mx-auto">{$arr->render()}</div>

            </div>
        </div>
    </div>
</div>
{eq name="Think.session.type" value="admin"}
{eq name="Think.session.cid" value="0"}
<!-- 总管理员js-->
<script>
    $.get("/Customer/getAllCid", function (result) {
        $("select[name=branch]").empty();
        option = "<option></option>";
        for (var j = 0; j < result.length; j++) {
            option += "<option value=\"" + result[j].id + "\">" + result[j].name + "</option>";
        }
        $("select[name=branch]").html(option)
    });
    $("select[name=branch]").change(function () {
        $.get("/Customer/getYidByCid/cid/"+$("select[name=branch]").val(), function (result) {
        $("select[name=doctor]").empty();
        option = "";
        for (var j = 0; j < result.length; j++) {
            option += "<option value=\"" + result[j].id + "\">" + result[j].name + "</option>";
        }
        $("select[name=doctor]").html(option)
    });
    });
</script>
{/eq}
<!-- 分店管理员js-->
<script>
    $.get("/Customer/getYidByCid/cid/{$Think.session.cid}", function (result) {
        $("select[name=doctor]").empty();
        option = "";
        for (var j = 0; j < result.length; j++) {
            option += "<option value=\"" + result[j].id + "\">" + result[j].name + "</option>";
        }
        $("select[name=doctor]").html(option)
    });
</script>
{/eq}
{include file="../template/footer.html" /}